package com.itheima.health.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestSecurityController {

    @PreAuthorize("hasAuthority('add')")
    @RequestMapping("/add")
    public String addData(){
        return "add OK";
    }

    @PreAuthorize("hasAuthority('delete')")
    @RequestMapping("/delete")
    public String deleteData(){
        return "delete ok";
    }
    @PreAuthorize("hasAuthority('update')")
    @RequestMapping("/update")
    public String updateData(){
        return "update ok";
    }

    @PreAuthorize("hasAuthority('find')")
    @RequestMapping("/find")
    public String findAll(){
        return "find ok";
    }
}
